#ifndef LOW_SIDE_H
#define LOW_SIDE_H
#include <stdint.h>
#include "drv.h"
#include "low_uart.h"
typedef enum
{
    PRE_SLEEP_NO = 0,
    PRE_SLEEP_EN,
} PRE_SLEEP_TYPE;

typedef enum
{
    WORK_MODE_INVALID = 0,
    WORK_MODE_PWM,
    WORK_MODE_TEMP,
} WORK_MODE_TYPE;


typedef enum
{
    INVALID = 0,
    VALID
} VALID_TYPE;

typedef union
{
    uint8_t data[8U];
    struct
    {
        VALID_TYPE message: 1;

        uint8_t pwm: 8;
        uint8_t temp: 8;
        uint16_t power_kw: 16;
#if 0
        WORK_MODE_TYPE work_mode: 2U;
        POWER_TYPE set_power: 3;
#endif
    } sig;
} PTC_data_struct;


typedef struct
{
    EM_TRUE_FALSE over_temp: 1;
    EM_TRUE_FALSE hot_temp: 1;
    EM_TRUE_FALSE down_power: 1;
    EM_TRUE_FALSE pcb_over_120: 1;
    EM_TRUE_FALSE pcb_over_125: 1;
    EM_TRUE_FALSE VBat_over: 1;
    EM_TRUE_FALSE VBat_low: 1;
    EM_TRUE_FALSE lock: 1;
    EM_TRUE_FALSE lin_mode_invalid: 1;

    ADC_VALUE_EM ntc_status:2;
    float Temp1_out;
    float Temp2_in;
    uint8_t PCB_temp;

    uint16_t VBat;

} low_side_status;
extern low_side_status low_side_st;

void low_data_init(void);
void low_handle(void);
#endif


